package org.hcyspartnoc.demo.controller.traProgram;

import org.hcyspartnoc.demo.common.core.AjaxResult;
import org.hcyspartnoc.demo.common.core.annotation.Log;
import org.hcyspartnoc.demo.common.core.annotation.PreAuthorize;
import org.hcyspartnoc.demo.common.core.enums.BusinessType;
import org.hcyspartnoc.demo.common.exception.traProgram.MajorException;
import org.hcyspartnoc.demo.pojo.vo.traProgram.MajorVo;
import org.hcyspartnoc.demo.service.traProgram.impl.MajorServiceImpl;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/majors")
public class MajorController {
    @Resource
    private MajorServiceImpl majorService;

    @Log(title = "培养方案·专业·获取·全部", businessType = BusinessType.OTHER, isSaveResponseData = false)
    @PreAuthorize(auth = "tp:majors:get:all", descr = "获取专业列表")
    @GetMapping("/get/list")
    public AjaxResult getMajors() throws MajorException {
        List<MajorVo> majorVoList = majorService.getMajors();
        return AjaxResult.success(majorVoList);
    }


}
